$(document)
		.ready(
				function() {
					var clientHeight = top.document.body.clientHeight - 200;
					var clientWidth = document.body.clientWidth - 100;
					$("button").button();
					var varname = $("#varname"), password = $("#password"), username = $("#username"), sex = $("#sex"), age = $("#age"), unit = $("#unit"), dept = $("#dept"), post = $("#post"), mobile = $("#mobile"), phone = $("#phone"), varmail = $("#varmail"), validdate = $("#validdate"), validflag = $("#validflag"), remark = $("#remark"), allFields = $(
							[]).add(varname).add(password).add(username).add(
							sex).add(age).add(unit).add(dept).add(post).add(
							mobile).add(phone).add(varmail).add(validdate).add(
							remark);
					$("#add").click(function() {
						$("#addinfo").dialog("open");
					});
					$("#mod").click(function() {
					});
					$("#del").click(function() {
					});
					$("#validdate").datepicker($.datepicker.regional["zh-CN"]);
					$("#addinfo")
							.dialog(
									{
										autoOpen : false,
										height : clientHeight,
										width : clientWidth,
										modal : true,
										buttons : {
											"Submit" : function() {
												var bValid = true;
												allFields
														.removeClass("ui-state-error");
												bValid = bValid
														&& checkLength(varname,
																"工号", 6, 16);
												bValid = bValid
														&& checkLength(
																password, "密码",
																6, 16);
												bValid = bValid
														&& checkLength(
																username, "名字",
																1, 16);
												bValid = bValid
														&& checkLength(age,
																"年龄", 1, 3);
												bValid = bValid
														&& checkLength(unit,
																"单位", 1, 100);
												bValid = bValid
														&& checkLength(dept,
																"部门", 1, 100);
												bValid = bValid
														&& checkLength(post,
																"岗位", 1, 100);
												if (bValid) {
													$(this).dialog("close");
												}
											},
											Cancel : function() {
												$(this).dialog("close");
											}
										}
									});
				});